﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace CourseSystem.Stat
{
    public class StatModule : IHttpModule
    {
        public void Init(HttpApplication context)
        {
            context.AcquireRequestState += context_BeginRequest;
        }

        void context_BeginRequest(object sender, EventArgs e)
        {
            HttpContext context = ((HttpApplication)sender).Context;
            var url = context.Request.RawUrl;
            //在线统计
            UserOnlineStat.Stat();
            //保鲜地址不做Ip统计/点击统计
            if (url.IndexOf("stat/flash", StringComparison.CurrentCultureIgnoreCase) < 0)
                return;
            //点击统计
            IpStat.HitsStat();
            //IP统计
            IpStat.IpStatDo();
        }

        public void Dispose()
        {
        }
    }
}
